#!/bin/bash
set -e
ulimit -n 1000000

DEPLOY_DIR={{ deploy_dir }}
cd "${DEPLOY_DIR}" || exit 1

{% set my_ip = hostvars[inventory_hostname].ansible_host | default(hostvars[inventory_hostname].inventory_hostname) -%}

exec > >(tee -i -a "{{ zookeeper_exporter_log_dir }}/{{ zookeeper_exporter_log_filename }}")
exec 2>&1

exec bin/zookeeper_exporter \
    -bind-addr=":{{ zookeeper_exporter_port }}" \
    --zookeeper="{{ my_ip }}:{{ zookeeper_port }}"

